component{
	
	include "../../inc/lib.cfm"; 
	
	public any function list(rc){
		var result = {};
		//从对象中进行Hql模式查询
		var offset = (rc.page-1)*rc.rows;
		hql = "from uploader where " & rc.sqlWhere & rc.sqlSort;
		var result["rows"] = ormExecuteQuery(hql, false, {maxResults=rc.rows, offset=offset});
		var totalhql = "select count(id) as total from uploader where " & rc.sqlWhere ;
		var result["total"] = ormExecuteQuery(totalhql, true);
		//返回数据
		return result;
	}
	
	public any function uploaderFiles(any rc){
		transaction {
            var q = entityNew("uploader");
			 q.setClientName(rc.clientName);
			 q.setServerName(rc.serverName);
			 q.setFileExt(rc.fileExt);
			 q.setFileSize(rc.fileSize);
			 q.setFileWidth(rc.fileWidth);
			 q.setFileHeight(rc.fileHeight);
			 q.setUserId(session.auth.userId);
			 entitySave(q);
             transactionCommit();
        }
        return q;
	}
	
	//获取操作
	public any function get(numeric id){
		result = entityLoadByPk("uploader", arguments.id);
		return result;
	}
	
	
	//获取操作
	public any function gets(any rc){
		hql = "from uploader where id in (#rc.ids#)";
		var result = ormExecuteQuery(hql, false);
		return result;
	}
	
}